using UnityEngine;
using System.Collections;

public class PlayerRespawnState : State<PlayerControl>
{
    #region Singleton

    private static PlayerRespawnState instance = new PlayerRespawnState();
    public static PlayerRespawnState Instance { get { return instance; } }
    private PlayerRespawnState() { }

    #endregion
    
    #region State

    public override void OnEnter(PlayerControl behaviour)
    {
        // TODO
        // Play animation respawnAnim
        // Play sound respawnSound
        behaviour.PlayAnimation(AnimationConstants.PLAYER_SPAWN);
        behaviour.gameObject.transform.position = behaviour.initialPosition;
    }

    public override void OnUpdate(PlayerControl behaviour)
    {
        // TODO
        // Block inputs
        // if respawnAnim.end -> nextState = Idle
        if (!behaviour.animation.isPlaying)
            behaviour.State = PlayerIdleState.Instance;
    }

    public override void OnExit(PlayerControl behaviour)
    {

    }

    public override void OnAction(string name, PlayerControl behaviour, object value)
    {

    }

    #endregion
}
